arch/sh: Check for kprobe trap number before trying to handle a kprobe trap
authorMichael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
Wed, 12 Jun 2019 13:08:37 +0000 (15:08 +0200)
committerSalvatore Bonaccorso <carnil@debian.org>
Thu, 26 Sep 2019 12:19:06 +0000 (13:19 +0100)
commit029c8ac062d1ba113e7112f3e44b23cca207cc94
tree01328b3ba8951b5bb124457b00296e9e763a647a
parent057dfd2e211ea0a3653d63ee62a00f5f839a5aba
arch/sh: Check for kprobe trap number before trying to handle a kprobe trap

The DIE_TRAP notifier chain is run both for kprobe traps and for BUG/WARN
traps. The kprobe code assumes to be only called for
BREAKPOINT_INSTRUCTION, and concludes to have hit a concurrently removed
kprobe if it finds anything else at the faulting locations. This includes
TRAPA_BUG_OPCODE used for BUG and WARN.

The consequence is that kprobe_handler returns 1. This makes
kprobe_exceptions_notify return NOTIFY_STOP, and prevents handling the BUG
statement. This also prevents moving $pc away from the trap instruction,
so the system locks up in an endless loop

Signed-off-by: Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
Gbp-Pq: Topic bugfix/sh
Gbp-Pq: Name sh-check-for-kprobe-trap-number-before-trying-to-handle-a-kprobe-trap.patch
arch/sh/kernel/kprobes.c